<?php

namespace Summer\Location\Http\Controllers;

use Illuminate\Routing\Controller;
use Summer\Hub\Http\Controllers\Traits\ApiReturn;
use Summer\Location\Models\AreaModel;
use Summer\Location\Models\CityModel;
use Input;
use Db;

class AreaController extends Controller
{
    use ApiReturn;

    public function index(){
        $city_code=Input::get('city_code');
        if(!$city_code){
            return $this->apiError('请选择城市');
        }
        $city=CityModel::where('code',$city_code)->first();
        if(!$city){
            return $this->apiError('查找失败');
        }
        $rdata=AreaModel::getNameList($city);
        return $this->apiSuccess('操作成功',$rdata);
    }
}
